- /* slcmput.cpp by K.Tsuru */
- // function ID = 901
- /**************************
- SLComplex class
- It provides the output.
- **************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- long SLComplex::Put(bool crlf, int fmt) const {
- SLong abs_im;
- long p = 0;
- if(fmt == BracketFMT){
- re.FPutc('('); p++;
- p += re.Put();
- re.FPuts(", "); p += 2;
- p += im.Put();
- re.FPutc(')'); p++;
- if(crlf){ re.FPutc('\n'); p++; }
- return p;
- }
- int imSign = im.Sign(901);
- if(imSign < 0) abs_im = Dabs(im);
-
- if(crlf) p = re.Puts();
- else p = re.Put();
-
- if(imSign < 0){
- p += re.FPuts("-i*");
- p += abs_im.Put();
- } else if(imSign > 0){
- p += re.FPuts("+i*");
- p += im.Put();
- } else p += re.FPuts("+i*0.0");
-
- if(crlf){
- re.FPutc('\n'); p++;
- }
- return p;
- }
slcmput.cpp : last modifiled at 2015/11/17 15:45:58(801 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).